<!DOCTYPE html>
<meta charset="utf-8" />
<link rel="stylesheet" href="css/page/role.css" />
<!-- 核心功能组件 -->
<script type="text/javascript" src="js/core/core-1.0.js" charset="utf-8"></script>
<div class="rowt">
<div class="col-xs-12">
<div class="tabbable" id="agent_form_div"  create-buttom="auto" check-form="true" create-to="formBtnBoxDiv" style="height: 100%">
	<form id="meridentifyForm" class="form-horizontal required-validate"  role="form"  onsubmit="return validateCallback(this,dialogAjaxDone)">
		<input type="hidden" id="idcardHandheld"   name="idcardHandheld" />
		<input type="hidden" id="idcardFront"   name="idcardFront" />
		<input type="hidden" id="idcardBack"   name="idcardBack" />
		<input type="hidden" id="type"   name="type" />
		
		<div class="tab-content">
			<div id="tabAgentInf" class="tab-pane fade in active">
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">
						商户名称： </label>
					<div class="col-sm-3">
						<!-- 
					 		 * 属性说明:
							 * validate="true"  是否需要验证字段
							 * msg="错误时提示信息"        
							 * datatype="数据类型"
						 -->
						<input type="text" id="custName" name="custName" placeholder="" 
							class="col-xs-12 col-sm-12" value="" />
					</div>
					
					<label class="col-sm-2 control-label no-padding-right">
						商户编号： </label>
					<div class="col-sm-3">
						<input type="text" id="custId" name="custId" placeholder="" 
							class="col-xs-12 col-sm-12" value="" />
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">
						商户类型： </label>
					<div class="col-sm-3">
							
			<select 
				 rel="obj.CUSTTYPE"
	 			 location="local" 
				 name="custType" 
	 			id="custType" 
	 			data-placeholder="请选择类型" style="width: 130px;vertical-align:middle;" readonly="readonly">
			</select>
					</div>
							<label class="col-sm-2 control-label no-padding-right">
								手机号： </label>
							<div class="col-sm-3">
								<input type="text" id="usrMobile" name="usrMobile"
									placeholder="" class="col-xs-12 col-sm-12" value="" />
							</div>
			</div>
			<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">
						合作商名称： </label>
					<div class="col-sm-3">
						<input type="text" id="agentName" name="agentName" placeholder="" 
							class="col-xs-12 col-sm-12" value="" />
					</div>
					
					<label class="col-sm-2 control-label no-padding-right">
						合作商编号： </label>
					<div class="col-sm-3">
						<input type="text" id="agentId" name="agentId" placeholder="" 
							class="col-xs-12 col-sm-12" value="" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label no-padding-right">
						证件类型： </label>
						<div class="col-sm-3">
						<select 
					 rel="obj.CERTTYPE"
		 			 location="local" 
					 name="certificateType" 
		 			id="certificateType" 
		 			data-placeholder="请选择类型" style="width: 130px;vertical-align:middle;" readonly="readonly">
			</select>
			</div>
					<label class="col-sm-2 control-label no-padding-right">
						证件号码： </label>
					<div class="col-sm-3">
						<input type="text" id="certificateNo" name="certificateNo" placeholder="" 
							class="col-xs-12 col-sm-12" value="" />
					</div>
				</div>
			<div class="form-group">
							<label class="col-sm-2 control-label no-padding-right">
								电子邮件： </label>
							<div class="col-sm-3">
								<input type="text" id="usrEmail" name="usrEmail"
									placeholder="" class="col-xs-12 col-sm-12" value="" />
							</div>
							<label class="col-sm-2 control-label no-padding-right">
								开户时间： </label>
							<div class="col-sm-3">
								<input type="text" id="custRegDatetime" name="custRegDatetime"
									placeholder="" class="col-xs-12 col-sm-12" value="" />
							</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-2 control-label no-padding-right">
								固定电话： </label>
							<div class="col-sm-3">
								<input type="text" id="usrTel" name="usrTel"
									placeholder="" class="col-xs-12 col-sm-12" value="" />
							</div>
							<label class="col-sm-2 control-label no-padding-right">
								冻结状态： </label>
							<div class="col-sm-3">
								<select 
									 rel="obj.USERSTATUS"
						 			 location="local" 
									 name="isLoginFlag" 
						 			id="isLoginFlag" 
						 			data-placeholder="请选择类型" style="width: 130px;vertical-align:middle;" readonly="readonly">
								</select>
							</div>
			</div>
			<div class="form-group">
							<label class="col-sm-2 control-label no-padding-right">
								认证状态： </label>
							<div class="col-sm-3">
								<select 
									 rel="obj.REGSTATUS"
						 			 location="local" 
									 name="authStatus" 
						 			id="authStatus" 
						 			data-placeholder="请选择类型" style="width: 130px;vertical-align:middle;" readonly="readonly">
								</select>
							</div>
			</div>
			</div>
		</div>
	</form>
</div>
<div class="form-actions align-right  form-button-box" style="margin-top: 10px;display:none;" id="formBtnBoxDiv">
	<button class="btn" type="button" onclick="javascript:dialog.closeById('dlg-agentEdit');">关闭</button>
</div>
<script type="text/javascript">
$(document).ready(function() {
	var h=document.documentElement.clientHeight;//可见区域高度
	var formDiv = document.getElementById('agent_form_div');
	formDiv.style.height=h*0.75+"px";
	$('.date-picker').datepicker({
		autoclose: true,
		todayHighlight: true
	})
	//show datepicker when clicking on the icon
	.next().on(ace.click_event, function(){
		$(this).prev().focus();
	});
	
	$("#oemState").change(function() {
		if($(this).val()=='on'||$(this).val()==1){
			$("#oemDiv").hide();
		}
		if($(this).val()==0){
			$("#oemDiv").show();
		}
	});


	setTimeout(setType, 600);
	setTimeout(setPic, 600);
});

function setPic(){
	document.getElementById("hand").src ="mpbase/pic/view2.do?picid="+$("#idcardHandheld").val();
	document.getElementById("front").src ="mpbase/pic/view2.do?picid="+$("#idcardFront").val();
	document.getElementById("back").src ="mpbase/pic/view2.do?picid="+$("#idcardBack").val();
}

function setType(){
	$("#formBtnBoxDiv").show();
		$("#meridentifyForm .btn-yellow").attr("disabled","disabled");
		$("#meridentifyForm input[type=text]").attr("readonly","readonly");
}



function dialogAjaxDone(result){
	if(result.rspcod== 200){
		msg.alert("提示",result.rspmsg,'correct');
		if($("#type").val()=='edit'||$("#type").val()=='audit'){
			$("#grid-table").trigger("reloadGrid");
			dialog.closeById('dlg-agentEdit');
		} else {
			location.href=$.getBaseHerf() + 'auth/mainPanel.do#mpomng/meridentifyManage/audit.do';
		}
	}else{
		msg.alert("错误",result.rspmsg,'error');
	}
}


/** 审核提交 **/
function meridentifyAuditSubmit(custStatus){
	var custId=$("#custId").val();
	var auditIdea=$("#auditIdea").val();
	$.ajax({
		type : "post",
		url : "mpomng/meridentifyManage/audit.do",
		data:{"custId":custId,"auditIdea":auditIdea,"custStatus":custStatus},
		dataType : 'json',
		success : function(result) {
			if(result.rspcod== 200){
				msg.alert("提示",result.rspmsg,'correct');
				$("#grid-table").trigger("reloadGrid");
				dialog.closeById('dlg-agentEdit');
			}else{
				msg.alert("错误",result.rspmsg,'error');
			}
		},
		error : function(XMLHttpRequest, textStatus) {
			msg.alert("错误", "错误代码：" + XMLHttpRequest.status + ",错误描述："+ textStatus, 'error');
		}
	});
	
}

</script>
